<template>
    <view style="padding: 10px 20px;">
        <view style="margin-bottom: 20upx;" >
            <u-button @click="handlePublish" type="primary">去发布</u-button>
        </view>
        <view v-if="topCompanyBasicList.length" style="margin-bottom:20upx">
            <mainList :baseList="topCompanyBasicList" type="publish" url="/pages/mine/toPublish"/>
        </view>
        <view v-else style="text-align: center;">
            <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/car.png">
            </u-empty>
        </view>
    </view>
  </template>
  
  <script>
  import mainList from '@/components/mainList/index.vue'
  import uTabs from '@/components/uTabs/index.vue'
  export default {
    components: {
        mainList,
        uTabs
    },
    data() {
      return {
        topCompanyBasicList: [],
      }
    },
    onShow() {
        this.getList()
    },
    methods: {
        async getList () {
            const res = await this.$api.getUserPublish({})
            this.topCompanyBasicList = res.map((item) => {
                return{
                    ...item,
                    name:item.user_title,
                    desc_text:item.user_name,
                    tag:item.user_phone,
                    msg:item.area_id || '北京'
                }
            })
        },
        handlePublish(){
            uni.navigateTo({
                url:'/pages/mine/toPublish'
            })
        }
    }
  }
  </script>
  
  <style>

  </style>
  